/**
 * Created by 000188 on 2016/7/6.
 */
import React from 'react';
import Ajax from 'superagent';
let Act = require('act');
let Logo = require('logo');
let Btn = require('btn');

let EndAct = React.createClass({
    render(){
        return <div>
            <Logo />
            <div className="end-act-title">您已是东方航空APP会员，请登录APP参与更多活动</div>
            <Act list={this.state.list} />
            <Btn width="100%" href="http://mobile.ceair.com/?from=timeline&isappinstalled=1" text="下载东方航空APP 参与更多活动" />
        </div>
    },
    getInitialState(){
        return {
            list: []
        }
    },
    componentDidMount(){
        if(window.history.state != 'act'){
            window.history.pushState('act','act','?act=1')
        }
        require(['config'], Config=> {
            Ajax.post(Config.api.user)
                .set('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8')
                .send({type:5})
                .end((err, res)=> {
                    if(err){
                        console.log(err);
                        return;
                    }else{
                        this.setState({
                            list: JSON.parse(res.text).Data
                        })
                    }
                })
        })
    }
});

module.exports = EndAct;
